package com.artPreter.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.artPreter.mapper.DepartMapper;
import com.artPreter.pojo.Artist;
import com.artPreter.pojo.ArtistRelative;
import com.artPreter.mapper.ArtistRelativeMapper;
import com.artPreter.pojo.Depart;
import com.artPreter.pojo.dto.ArtistRelativeDTO;
import com.artPreter.pojo.dto.RelationArtistDTO;
import com.artPreter.service.IArtistRelativeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 艺术机构-艺术家关系表 服务实现类
 * </p>
 *
 * @author jarvis
 * @since 2024-11-15
 */
@Service
public class ArtistRelativeServiceImpl extends ServiceImpl<ArtistRelativeMapper, ArtistRelative> implements IArtistRelativeService {


    @Override
    public List<ArtistRelativeDTO> getListByArtistId(Artist artist) {
        if(artist.getArtistId()== null){
            return null;
        }
        QueryWrapper<ArtistRelative> wrapper = new QueryWrapper<>();
        // 已绑定关系
        wrapper.eq("s.status", 1);
        // 艺术家id
        wrapper.eq("s.artist_id", artist.getArtistId());
        List<ArtistRelativeDTO> result = this.baseMapper.getListByArtistId(wrapper);
        return result;
    }
}
